﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Skynet.BusinessLogic.BusinessComponents;
using Microsoft.Practices.Unity;
using Skynet.WebFoundation.Services.Session;

namespace Skynet.WebFoundation.Views.Login
{
    public class LoginPresenter : Infrastructure.Web.Views.Master.MasterPresenter<ILoginView>
    {
        [Dependency]
        public IBCCustomers BCCustomers { get; set; }

        [Dependency]
        public IBCCustomersQueries BCCustomersQueries { get; set; }

        [Dependency]
        public ISessionService SessionService { get; set; }
        
        public void LoginSuccess(string UserName)
        {
            this.SessionService.CustomerId = this.BCCustomersQueries.FindCustomers(option: CustomerFindOptions.GetByUserName, UserName: UserName).Single().Id;
        }
    }
}
